package com.youle.contoller;

import com.youle.enums.ExceptionEnum;
import com.youle.exception.YLException;
import com.youle.service.ItemSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by
 *
 * @author touni
 * @date 2019/4/22
 * @time 18:30
 */
@RestController
@RequestMapping("sku")
public class ItemSkuController {

    @Autowired
    private ItemSkuService itemSkuService;


    /**
     * 根据spuid查询sku的表
     * @param id
     * @return
     */
    @RequestMapping("list")
    public ResponseEntity listSkuBySpuId(Long id){
        if (null == id){
            throw new YLException(ExceptionEnum.PARAM_NOT_BE_NULL);
        }
        return this.itemSkuService.listSkuBySpuId(id);



    }







}
